@include('Home.head')
<body>
<style>
    @media screen and (max-width: 639px){
        .cart-panel-ul > li {
            height: auto;
        }
    }
</style>
<div class="container" id="app">
    <header data-am-widget="header" class="am-header am-header-default my-header">
        <div class="am-header-left am-header-nav">
            <a href="javascript:history.back(-1);" class="">
                <i class="am-header-icon am-icon-chevron-left"></i>
            </a>
        </div>
        <h1 class="am-header-title">
            <a href="#title-link" class="">@{{title}}</a>
        </h1>
        <div class="am-header-right am-header-nav">
            <a href="#right-link" class="">
                <i class="am-header-icon  am-icon-home"></i>
            </a>
        </div>
    </header>
	<div class="gray-panel">
    	<div class="paoduct-title-panel">
        	<h2 class="checkout-h2"><span class="am-badge am-round am-badge-warning ">1</span> 确认订单信息</h2>
			
            <div v-if='type == "replenish"'>
                <div class="cart-list-panel">
                    <ul class="am-avg-sm-1 cart-panel-ul">
                        <li style="display: flex">
                            <div class="imgpanel"><a><img style="width: 90px;height: 90px;" :src="order.img" class="am-img-responsive" /></a></div>
                            <div class="infopanel">
                                <h3><a>@{{ order.goods_name }}</a></h3>
                                <!-- <p>品牌：新世界</p> -->
                                <p>补货数量：<span class="red2 bold">@{{ order.invoices }}</p>
                               <!-- <p>复消数量：<span class="red2 bold">@{{ order.resale }}</p> -->
                                <p v-show="order.invoices_specs">报单规格：@{{ order.invoices_specs }}</p>
                                <p v-show="order.resale_specs">复消规格：@{{ order.resale_specs }}</p>
                            </div>
                        </li>
                    </ul>
                </div>
                <!-- <div class="cart_foot" v-show="order.postage">邮费：<span class="red2 bold" id="total_amount">@{{ order.postage }}</span>元 -->
                </div>
            </div>
            <div v-else>
                <div class="cart-list-panel">
                    <ul class="am-avg-sm-1 cart-panel-ul">
                        <li style="display: flex">
                            <div class="imgpanel"><a><img :src="order.img" class="am-img-responsive" /></a></div>
                            <div class="infopanel">
                                <h3><a>@{{ order.goods_name }}</a></h3>
                                <p>品牌：新世界</p>
                                <p>价格：<span class="red2 bold">@{{ order.price }}</span> 元  X @{{ order.total_quantity }}</p>
                                <p v-show="order.specs_txt">规格：@{{ order.specs_txt }}</p>
                            </div>
                        </li>
                    </ul>
                </div>
                <div class="cart_foot">总数量：<span class="red2 bold" id="total_jifen">@{{ order.total_quantity }}</span> 个，
                    邮费：<span class="red2 bold" id="total_amount">@{{ order.postage }}</span>
                    总价：<span class="red2 bold" id="total_amount">@{{ order.total }}</span>元
                </div>
            </div>

        </div>
        <div class="paoduct-title-panel">
            <h2 class="checkout-h2"><span class="am-badge am-round am-badge-warning ">2</span> 收货地址</h2>
            <div class="partners-title-panel" >

                <div class="partners-title-panel-title "  style="height: auto;padding-left: 10px;">
                    @{{ order.consignee }}  &nbsp;@{{ order.phone }}
                    <a>@{{ order.address }}</a>
                </div>
            </div>
        </div>


    </div>
    @include('Home.foot')
</div>
</body>
<script>
    var app = new Vue({
        el: "#app",
        data: {
            title: '进货详情',
            order:{},
            address:{},
            type:'',
        },
        methods: {
            //初始化 系统管理员列表
            initialize: function () {
                var id = this.obtain('id');
                if (id > 0) {
                    if (this.type == 'replenish') {
                        this.title='补货详情'
                        $.post("/home/stores/getReplenishRecord", {'_token': '{{csrf_token()}}',class:'detail',id:id}, function (res) {
                            // console.log(res)
                            if (res.code) {
                                app.order = res.data
                                // console.log( app.order );
                                // app.address = res.data.address
                            } else {
                                layer.msg(res.data);
                            }
                        });
                    }else{
                        $.post("/home/stores/getPurchaseRecord", {'_token': '{{csrf_token()}}',class:'detail',id:id}, function (res) {
                            // console.log(res)
                            if (res.code) {
                                app.order = res.data
                                // console.log( app.order );
                                // app.address = res.data.address
                            } else {
                                layer.msg(res.data);
                            }
                        });

                    }
                }
            },
            //获取url id
            obtain:function (val) {
                var query = window.location.search.substring(1);
                var vars = query.split("&");
                for (var i=0;i<vars.length;i++) {
                    var pair = vars[i].split("=");
                    if(pair[0] == val){
                        return pair[1];
                    }
                }
            },
        },
        created() {
            this.type = this.obtain('type')
            // console.log(this.type)
        },
        //自动执行
        mounted: function () {
            this.initialize();
        },
    })
</script>
</html>
